package view.panel
{
	import control.panel.IPanelControl;
	
	import flash.text.TextField;
	
	import model.room.RoomData;
	
	import utils.TextTool;
	
	public class RoomInfoPanel extends AbsPanel
	{
		private var roomIdText:TextField;//id
		private var roomNameText:TextField;//名字
		private var roomPriceText:TextField;//低价
		private var roomLevelText:TextField;//条件
		private var roomFeeText:TextField;//费用
		
		public function RoomInfoPanel(panelControl:IPanelControl)
		{
			super(panelControl);
			init();
			resetBg(160,120);
		}
		
		private function init():void
		{
			roomIdText = TextTool.getTextField(60,18,12,0xFFFFFF);
			roomNameText = TextTool.getTextField(60,18,12,0xFFFFFF);
			roomPriceText = TextTool.getTextField(60,18,12,0xFFFFFF);
			roomLevelText = TextTool.getTextField(60,18,12,0xFFFFFF);
			roomFeeText = TextTool.getTextField(60,18,12,0xFFFFFF);
			
			roomIdText.x = roomNameText.x = roomPriceText.x = roomLevelText.x = roomFeeText.x = 80;
			roomIdText.y = 12;
			roomNameText.y = 32;
			roomPriceText.y = 52;
			roomLevelText.y = 72;
			roomFeeText.y = 92;
			
			addChild(roomIdText);
			addChild(roomNameText);
			addChild(roomPriceText);
			addChild(roomLevelText);
			addChild(roomFeeText);
			
			 createLabel(10,12,"房间ID:");
			 createLabel(10,32,"房间名字:");
			 createLabel(10,52,"底价:");
			 createLabel(10,72,"准入条件:");
			 createLabel(10,92,"座位费用:");
		}
		
		private function createLabel(x:int,y:int,text:String):void
		{
			var label:TextField = TextTool.getTextField(70,18,12,0xFFFFFF,false,false,"right");
			label.x = x;
			label.y = y;
			label.text = text;
			addChild(label);
		}
		
		public function updateInfo(roomData:RoomData):void
		{
			roomIdText.text = roomData.id.toString();
			roomNameText.text = roomData.roomName;
			roomPriceText.text = roomData.betTime.toString();
			roomLevelText.text = roomData.playCondition.toString();
			roomFeeText.text = roomData.fee.toString(); 
		}
	}
}